/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package DG.impl;

import DG.Clazz;
import DG.DGPackage;
import DG.DiagClass;

import DG.Operation;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Diag Class</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link DG.impl.DiagClassImpl#getClazzes <em>Clazzes</em>}</li>
 *   <li>{@link DG.impl.DiagClassImpl#getOps <em>Ops</em>}</li>
 *   <li>{@link DG.impl.DiagClassImpl#getSuper <em>Super</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class DiagClassImpl extends EObjectImpl implements DiagClass {
	/**
	 * The cached value of the '{@link #getClazzes() <em>Clazzes</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getClazzes()
	 * @generated
	 * @ordered
	 */
	protected EList<Clazz> clazzes;
	/**
	 * The cached value of the '{@link #getOps() <em>Ops</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOps()
	 * @generated
	 * @ordered
	 */
	protected EList<Operation> ops;

	/**
	 * The cached value of the '{@link #getSuper() <em>Super</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSuper()
	 * @generated
	 * @ordered
	 */
	protected Clazz super_;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DiagClassImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DGPackage.Literals.DIAG_CLASS;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Clazz> getClazzes() {
		if (clazzes == null) {
			clazzes = new EObjectResolvingEList<Clazz>(Clazz.class, this, DGPackage.DIAG_CLASS__CLAZZES);
		}
		return clazzes;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Operation> getOps() {
		if (ops == null) {
			ops = new EObjectResolvingEList<Operation>(Operation.class, this, DGPackage.DIAG_CLASS__OPS);
		}
		return ops;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Clazz getSuper() {
		if (super_ != null && super_.eIsProxy()) {
			InternalEObject oldSuper = (InternalEObject)super_;
			super_ = (Clazz)eResolveProxy(oldSuper);
			if (super_ != oldSuper) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, DGPackage.DIAG_CLASS__SUPER, oldSuper, super_));
			}
		}
		return super_;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Clazz basicGetSuper() {
		return super_;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSuper(Clazz newSuper) {
		Clazz oldSuper = super_;
		super_ = newSuper;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DGPackage.DIAG_CLASS__SUPER, oldSuper, super_));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case DGPackage.DIAG_CLASS__CLAZZES:
				return getClazzes();
			case DGPackage.DIAG_CLASS__OPS:
				return getOps();
			case DGPackage.DIAG_CLASS__SUPER:
				if (resolve) return getSuper();
				return basicGetSuper();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case DGPackage.DIAG_CLASS__CLAZZES:
				getClazzes().clear();
				getClazzes().addAll((Collection<? extends Clazz>)newValue);
				return;
			case DGPackage.DIAG_CLASS__OPS:
				getOps().clear();
				getOps().addAll((Collection<? extends Operation>)newValue);
				return;
			case DGPackage.DIAG_CLASS__SUPER:
				setSuper((Clazz)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case DGPackage.DIAG_CLASS__CLAZZES:
				getClazzes().clear();
				return;
			case DGPackage.DIAG_CLASS__OPS:
				getOps().clear();
				return;
			case DGPackage.DIAG_CLASS__SUPER:
				setSuper((Clazz)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case DGPackage.DIAG_CLASS__CLAZZES:
				return clazzes != null && !clazzes.isEmpty();
			case DGPackage.DIAG_CLASS__OPS:
				return ops != null && !ops.isEmpty();
			case DGPackage.DIAG_CLASS__SUPER:
				return super_ != null;
		}
		return super.eIsSet(featureID);
	}

} //DiagClassImpl
